Skip to content

Conversation

@atobiszei
Copy link
Collaborator

@atobiszei atobiszei commented Oct 23, 2025

  • Improve tests to verify if produced output is proper JSON

Ticket:CVS-175213

@atobiszei atobiszei added the WIP Do not merge until resolved label Oct 23, 2025
@atobiszei atobiszei force-pushed the atobisze_qwen3coder_escape_quotes branch 2 times, most recently from bb763c2 to 572d366 Compare October 29, 2025 15:19
* Improve tests to verify if produced output is proper JSON
@atobiszei atobiszei force-pushed the atobisze_qwen3coder_escape_quotes branch from 572d366 to e288b6d Compare October 30, 2025 12:42
@atobiszei atobiszei changed the title Check fix Add fix for Qwen3Coder tool parser quote handling Nov 4, 2025
@atobiszei atobiszei requested a review from Copilot November 4, 2025 10:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes quote handling in the Qwen3Coder tool parser by introducing proper escaping of double quotes within string parameters. The fix ensures that JSON arguments containing quotes are properly escaped, preventing JSON parsing errors.

Key Changes

  • Added escapeQuotes() function to escape double quotes in string values
  • Updated setCorrectValueType() to use the new escaping function for STRING parameters
  • Enhanced test coverage to validate that generated JSON is parsable, including edge cases with Python triple-quoted strings and nested quotes

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/llm/io_processing/qwen3coder/qwen3coder_tool_parser.cpp Implements quote escaping logic to fix JSON generation for string parameters
src/test/llm/output_parsers/qwen3coder_output_parser_test.cpp Adds test cases with complex string content and JSON validation checks

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@atobiszei atobiszei removed the WIP Do not merge until resolved label Nov 4, 2025
} else {
parameterValue = escapeString(setCorrectValueType(parameterValue, this->currentParameterName, paramIt->second));
// we don't want to escape entry/exit " for string parameters
parameterValue = escapeNewline(setCorrectValueType(parameterValue, this->currentParameterName, paramIt->second));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why newline only for booleans and quotes only for strings?

@atobiszei atobiszei merged commit a2ec47a into main Nov 5, 2025
1 check passed
@atobiszei atobiszei deleted the atobisze_qwen3coder_escape_quotes branch November 5, 2025 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants